#pragma once

#ifndef CV_TEST_H
#define CV_TEST_H

#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>

using namespace std;
using namespace cv;


class Solution
{
private:
	Solution();

public:
	static Mat src_gray;
	static int thresh;
	static RNG rng;

	Mat src = imread("E:/VSProject/TEST/knightProbility/x64/Debug/5.jpg");

	static void thresh_callback(int, void*) {
		Mat canny_output;
		Canny(src_gray, canny_output,thresh,2*thresh );
		vector<vector<Point> > contours;
		vector<Vec4i> hierarchy;
		findContours(canny_output, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE);
		Mat drawing = Mat::zeros(canny_output.size(), CV_8UC3);
		for (size_t i = 0; i < contours.size(); i++)
		{
			Scalar color = Scalar(rng.uniform(0, 256), rng.uniform(0, 256), rng.uniform(0, 256));
			drawContours(drawing, contours, (int)i, color, 2, LINE_8, hierarchy, 0);
		}
		resize(drawing, drawing, Size(200, 200));
		imshow("Contours", drawing);
	}


};

#endif

